package com.gujia.designpattern.observe.push;

import com.gujia.designpattern.observe.push.impl.ConcreateObserve;

public class Client {

    public static void main(String[] args) {
        //1  创建目标
        ConcreateWeatherSubject weatherSubject = new ConcreateWeatherSubject();
        //2  创建观察者
        ConcreateObserve observeGirl = new ConcreateObserve();
        observeGirl.setObserverName("黄明的女朋友");
        observeGirl.setRemindThing("是我们的第一次约会，地点街心公园，不见不散");

        ConcreateObserve observeMum = new ConcreateObserve();
        observeMum.setObserverName("老妈");
        observeMum.setRemindThing("是一个购物的好日子,明天去天虹扫货");
        //3 注册观察者
        weatherSubject.attach(observeGirl);
        weatherSubject.attach(observeMum);
        //4 目标发布天气
        weatherSubject.setWeatherContent("明天天气晴朗，蓝天白云");
    }
}
